for /f %%k in ('jq-win64.exe .type_tag %1\%2\entry.json') do ( set tag=%%k)
echo typetag=%tag%

for /f %%j in ('jq-win64.exe .has_dash_audio %1\%2\entry.json') do ( set has_Audio=%%j)
echo hasAudio=%has_Audio%

for /f %%y in ('jq-win64.exe .media_type %1\%2\entry.json') do ( set media_type=%%y)
echo mediaType=%media_type%

jq-win64.exe .page_data.download_subtitle %1\%2\entry.json>_tmp.txt
set /p filename=<"_tmp.txt" 
call format.bat %filename% _tmp.txt
set /p filename=<"_tmp.txt" 
echo %filename%

if %media_type% EQU 2 (
	if %has_Audio% equ true (
		ffmpeg -y -i %1\%2\\%tag%\video.m4s -i %1\%2\\%tag%\audio.m4s -c:v copy -strict experimental %1\\%filename%.mp4
	)  else (
		ffmpeg -y -i %1\%2\\%tag%\video.m4s -c:v copy -strict experimental %1\\%filename%.mp4
	)  
) else (
	copy /Y %1\%2\\%tag%\0.blv %1\%2\\%tag%\0.flv 
	ffmpeg -y -i %1\%2\\%tag%\0.flv -c copy %1\\%filename%.mp4
	rem del /f %1\%2\\%tag%\0.flv 
)
del /f  _tmp.txt

